package view.pieces;

import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.geom.Rectangle2D;
import java.util.Observable;

import javax.swing.ImageIcon;

import resources.GlobalSettings;
import resources.ImageBundle;

import model.pieces.Wall;

public class WallDisplayView extends PieceDisplayView {

	private static final Image wallImage = new ImageIcon(
			ImageBundle.get("wall_" + GlobalSettings.pieceImageWidth))
			.getImage();

	public WallDisplayView(Graphics2D g2d, Wall wall) {
		super(g2d, wall);
	}

	@Override
	public void paint(Graphics2D g2D) {
		this.g2D = g2D;

		Rectangle2D rect = getPieceRectangle();

		// rectangulo principal
		this.g2D.setColor(GlobalSettings.levelPanelColor);
		this.g2D.fill(rect);
		this.g2D.setColor(GlobalSettings.levelPanelColor);
		this.g2D.draw(rect);

		this.g2D.drawImage(wallImage, (int) rect.getMinX(),
				(int) rect.getMinY(), (int) rect.getMaxX(),
				(int) rect.getMaxY(), 0, 0, GlobalSettings.pieceImageWidth,
				GlobalSettings.pieceImageHeight, null);
		/*
		 * // LADRILLOS Color Marron = new Color(136, 23, 0);// 164,82,0 // 1
		 * this.g2D.setColor(Marron); this.g2D.fillRect((int) rect.getX() + 2,
		 * (int) rect.getY() + 2, 15, 10); this.g2D.setColor(Color.GRAY);
		 * this.g2D.drawRect((int) rect.getX() + 2, (int) rect.getY() + 2, 15,
		 * 10); // 2 this.g2D.setColor(Marron); this.g2D.fillRect((int)
		 * rect.getX() + 16, (int) rect.getY() + 2, 21, 10);
		 * this.g2D.setColor(Color.GRAY); this.g2D.drawRect((int) rect.getX() +
		 * 16, (int) rect.getY() + 2, 21, 10); // 3 this.g2D.setColor(Marron);
		 * this.g2D.fillRect((int) rect.getX() + 2, (int) rect.getY() + 10, 10,
		 * 8); this.g2D.setColor(Color.GRAY); this.g2D.drawRect((int)
		 * rect.getX() + 2, (int) rect.getY() + 10, 10, 8); // 4
		 * this.g2D.setColor(Marron); this.g2D.fillRect((int) rect.getX() + 13,
		 * (int) rect.getY() + 10, 8, 22); this.g2D.setColor(Color.GRAY);
		 * this.g2D.drawRect((int) rect.getX() + 13, (int) rect.getY() + 10, 8,
		 * 22); // 5 this.g2D.setColor(Marron); this.g2D.fillRect((int)
		 * rect.getX() + 21, (int) rect.getY() + 10, 8, 8);
		 * this.g2D.setColor(Color.GRAY); this.g2D.drawRect((int) rect.getX() +
		 * 21, (int) rect.getY() + 10, 8, 8); // 6 this.g2D.setColor(Marron);
		 * this.g2D.fillRect((int) rect.getX() + 30, (int) rect.getY() + 10, 9,
		 * 8); this.g2D.setColor(Color.GRAY); this.g2D.drawRect((int)
		 * rect.getX() + 30, (int) rect.getY() + 10, 9, 8); // 7
		 * this.g2D.setColor(Marron); this.g2D.fillRect((int) rect.getX() + 1,
		 * (int) rect.getY() + 18, 10, 8); this.g2D.setColor(Color.GRAY);
		 * this.g2D.drawRect((int) rect.getX() + 1, (int) rect.getY() + 18, 10,
		 * 8); // 8 this.g2D.setColor(Marron); this.g2D.fillRect((int)
		 * rect.getX() + 21, (int) rect.getY() + 18, 12, 8);
		 * this.g2D.setColor(Color.GRAY); this.g2D.drawRect((int) rect.getX() +
		 * 21, (int) rect.getY() + 18, 12, 8); // 9 this.g2D.setColor(Marron);
		 * this.g2D.fillRect((int) rect.getX() + 34, (int) rect.getY() + 18, 5,
		 * 21); this.g2D.setColor(Color.GRAY); this.g2D.drawRect((int)
		 * rect.getX() + 34, (int) rect.getY() + 18, 5, 21); // 10
		 * this.g2D.setColor(Marron); this.g2D.fillRect((int) rect.getX() + 1,
		 * (int) rect.getY() + 26, 12, 5); this.g2D.setColor(Color.GRAY);
		 * this.g2D.drawRect((int) rect.getX() + 1, (int) rect.getY() + 26, 12,
		 * 5); // 11 this.g2D.setColor(Marron); this.g2D.fillRect((int)
		 * rect.getX() + 21, (int) rect.getY() + 26, 13, 5);
		 * this.g2D.setColor(Color.GRAY); this.g2D.drawRect((int) rect.getX() +
		 * 21, (int) rect.getY() + 26, 13, 5); // 12 this.g2D.setColor(Marron);
		 * this.g2D.fillRect((int) rect.getX() + 2, (int) rect.getY() + 31, 32,
		 * 5); this.g2D.setColor(Color.GRAY); this.g2D.drawRect((int)
		 * rect.getX() + 2, (int) rect.getY() + 31, 32, 5); // 13
		 * this.g2D.setColor(Marron); this.g2D.fillRect((int) rect.getX() + 1,
		 * (int) rect.getY() + 36, 15, 3); this.g2D.setColor(Color.GRAY);
		 * this.g2D.drawRect((int) rect.getX() + 1, (int) rect.getY() + 36, 15,
		 * 3); // 14 this.g2D.setColor(Marron); this.g2D.fillRect((int)
		 * rect.getX() + 16, (int) rect.getY() + 36, 18, 3);
		 * this.g2D.setColor(Color.GRAY); this.g2D.drawRect((int) rect.getX() +
		 * 16, (int) rect.getY() + 36, 18, 3);
		 */
	}

	@Override
	public void update(Observable o, Object arg) {
		this.paint(this.g2D);
	}

}
